package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ChildGreatBean;
import com.xuxin.baby.contract.ChildGreatContract;
import com.xuxin.baby.model.ChildGreatModel;

/**
 * Created by xu_xin
 * Created on 2020/10/22 0022
 * 宝宝大事记
 */
public class ChildGreatPresenter implements ChildGreatContract.Presenter {
    private  final ChildGreatModel model;
    private  final ChildGreatContract.View view;

    public ChildGreatPresenter(ChildGreatContract.View view) {
        this.view = view;
        model = new ChildGreatModel();
    }

    @Override
    public void getChildGreat(String tenantId, String token, String childId, String eventType, int skipCount) {
        if (null != model) {
            model.getChildGreat(this, tenantId, token, childId, eventType, skipCount);
        }
    }

    @Override
    public void onSuccess(ChildGreatBean childGreatBean) {
        if (null != view) {
            view.onSuccess(childGreatBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}